home *** CD-ROM | disk | FTP | other *** search
- Path: news.uiowa.edu!usenet
- From: larued@crpl.cedar-rapids.lib.ia.us
- Newsgroups: comp.lang.c++
- Subject: Re: IDEAS NEEDED!!, Saving Trees
- Date: 10 Apr 1996 23:59:22 GMT
- Organization: University of Iowa, Iowa City, IA, USA
- Distribution: world
- Message-ID: <4khi0q$vis@flood.weeg.uiowa.edu>
- References: <4kgasf$4eg@news.eng.octel.com>
- Reply-To: larued@crpl.cedar-rapids.lib.ia.us
- NNTP-Posting-Host: ppp-110.cedar-rapids.lib.ia.us
- X-Newsreader: IBM NewsReader/2 v1.9d - NLS
-
- In <4kgasf$4eg@news.eng.octel.com>, wdengel@ibm.net (Wayne) writes:
- >Hello, and Help..
- >
- >I am looking for an easy (NOTHING COMPLICATED IS EASY) way to have a tree with
- >variant records as each node. I need each node to have an unlimited number of
- >branches. I then would like to save the whole tree in ONE file.
- >
- >So:
- > TREE
- > Variant Record Size Nodes
- > Unlimited Branches per Node
- > Need to Save to ONE file.
- >
- >I know this can be done, but I don't want to write a whole garbage collection
- >system and tree system is someone has already done this.
- >
- >I would like the NODES to be some sort of baseClass that I can use to
- >virtualize the SAVE function for each node. (A Node is an object.)
- >
- >If anybody has an IDEA, please post.
- >
- >Thanks for the help..
- >
- >Wayne D.
- >
- This sounds simple enough. I've been doing it for some time now. My
- approach used the IBM C Set/2 Collection Classes. It allows for sets and
- other tree structures. I defined an abstract base type and a tree of
- the abstract base type. Actually mine is more complicated but it could be
- generalized to be branch of (branches or leafs). Most beginning C++ books
- show implementations of this. Check out the C++ Algorythms Books. Also
- define input and output routines for each node type. I called mine build
- and parse. They were similar to << and >> except that they allowed me extra
- flexibility for parameters. I also have examples based on array
- implementations. It was for using tag/length/data files. The runtime
- structures were edited by conventional class overrides.
-
- I'ld be glad to work with you email. I don't have any quick eamples to
- mail/post.
-
- Good luck,
-
- Dave LaRue
- Team OS/2, ACM, IEEE
-